package com.projects.android.views;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.projects.android.R;

public class EditQuantity extends Dialog implements android.view.View.OnClickListener {
	private Button btnOK;
	private Button btnCancel;
	private EditText txtQuantity;
	private String quantity;
	
	public EditQuantity(Context context, String _quantity) {
		super(context);
		// TODO Auto-generated constructor stub
		quantity = _quantity;
	}

	// Use an existing ListAdapter that will map an array
	// of strings to TextViews
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.editquantity);
		initFrm();
    }
	
	private void initFrm(){
		btnOK = (Button)findViewById(R.id.btnEditQuantityOK);
		btnCancel = (Button)findViewById(R.id.btnEditQuantityCancel);
		txtQuantity = (EditText)findViewById(R.id.txtEditQuantity);
		txtQuantity.setText(quantity);
		
		btnCancel.setOnClickListener(this);
	}

	public void setBtnOK(Button btnOK) {
		this.btnOK = btnOK;
	}

	public Button getBtnOK() {
		return btnOK;
	}
	
	public EditText getTxtQuantity() {
		return txtQuantity;
	}

	public void setTxtQuantity(EditText txtQuantity) {
		this.txtQuantity = txtQuantity;
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btnEditQuantityCancel:
			dismiss();
		}
	}
}
